import os

# 设置代理
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"

# 设置本地缓存目录
cache_dir = os.path.join('D:', os.path.sep, 'ModelSpace', 'Cache')
os.environ['HF_HOME'] = cache_dir

from transformers import pipeline

# 创建Pipeline任务
nlp = pipeline("fill-mask", model="google-bert/bert-base-chinese")

# 执行填充蒙版任务
if __name__ == "__main__":
    result = nlp("生活的真谛是[MASK]。")

    print(result)
